package org.br.plotter.gui;

import javax.swing.*;

import org.br.plotter.parser.fft.FastFourierTransform;

public class XYScalePanel extends JPanel {
	private LabelComponentPanel scaleLabel[];

	public XYScalePanel(String[] labels, double[] scales) {
		BoxLayout layout = new BoxLayout(this, BoxLayout.Y_AXIS);
		setLayout(layout);
		scaleLabel = new LabelComponentPanel[labels.length];
		for (int i = 0; i < labels.length; i++) {
			scaleLabel[i] = new LabelComponentPanel(labels[i], String
					.valueOf(scales[i]));
			scaleLabel[i].setVerifier(NumericVerifier.instance);
			add(scaleLabel[i]);
		}
	}

	public double[] getRequiredData() {
		int length = scaleLabel.length;
		double[] result = new double[length];
		for (int i = 0; i < length; i++) {
			result[i] = Double.parseDouble(scaleLabel[i].getValue());
		}		
		return result;
	}
	

}